---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

nova_service_port: 8774
nova_service_proto: http
nova_metadata_protocol: "{{ openstack_service_internaluri_proto | default(nova_service_proto) }}"
nova_metadata_insecure: False
nova_service_adminuri_proto: "{{ openstack_service_adminuri_proto | default(nova_service_proto) }}"
nova_service_adminuri: "{{ nova_service_adminuri_proto }}://{{ internal_lb_vip_address }}:{{ nova_service_port }}"
nova_service_adminurl: "{{ nova_service_adminuri }}/v2.1"
nova_console_type: spice
nova_novncproxy_port: 6080
nova_spice_html5proxy_base_port: 6082
nova_serialconsoleproxy_port: 6083
nova_console_port: "{% if nova_console_type == 'spice' %}{{ nova_spice_html5proxy_base_port }}{% elif nova_console_type == 'novnc' %}{{ nova_novncproxy_port }}{% else %}{{ nova_serialconsoleproxy_port }} {% endif %}"

# These are here rather than in nova_all because
# both the os_ceilometer and os_nova roles require them

# RPC
nova_rabbitmq_userid: nova
nova_rabbitmq_vhost: /nova
nova_rabbitmq_port: "{{ rabbitmq_port }}"
nova_rabbitmq_servers: "{{ rabbitmq_servers }}"
nova_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}"
nova_rabbitmq_host_group: "{{ rabbitmq_host_group }}"

# Telemetry notifications
nova_rabbitmq_telemetry_userid: "{{ nova_rabbitmq_userid }}"
nova_rabbitmq_telemetry_password: "{{ nova_rabbitmq_password }}"
nova_rabbitmq_telemetry_vhost: "{{ nova_rabbitmq_vhost }}"
nova_rabbitmq_telemetry_port: "{{ nova_rabbitmq_port }}"
nova_rabbitmq_telemetry_servers: "{{ nova_rabbitmq_servers }}"
nova_rabbitmq_telemetry_use_ssl: "{{ nova_rabbitmq_use_ssl }}"
nova_rabbitmq_telemetry_host_group: "{{ nova_rabbitmq_host_group }}"

# If there are any Designate hosts in the environment, then enable its usage
nova_designate_enabled: "{{ (groups['designate_all'] is defined) and (groups['designate_all'] | length > 0) }}"
# If there are any Ceilometer hosts in the environment, then enable its usage
nova_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}"
# If there are any Barbican hosts in the environment, then enable its usage
nova_barbican_enabled: "{{ hostvars['localhost']['nova_barbican_enabled'] }}"

# The MySQL details for the nova service
nova_galera_user: nova
nova_galera_database: nova
nova_galera_address: "{{ galera_address }}"
nova_api_galera_user: nova_api
nova_api_galera_database: nova_api
nova_api_galera_address: "{{ galera_address }}"
nova_cell0_database: nova_cell0

nova_external_ssl: "{{ openstack_external_ssl }}"
nova_ceph_client_uuid: '{{ cinder_ceph_client_uuid | default() }}'
nova_dhcp_domain: "{{ dhcp_domain }}"
nova_service_in_ldap: "{{ service_ldap_backend_enabled }}"
nova_glance_api_servers: "{{ glance_api_servers }}"

# Ensure that the package state matches the global setting
nova_package_state: "{{ package_state }}"

# The system user for all nova services
nova_system_user_name: nova

# venv fetch configuration
nova_venv_tag: "{{ venv_tag }}"
nova_bin: "/openstack/venvs/nova-{{ nova_venv_tag }}/bin"
nova_venv_download_url: "{{ venv_base_download_url }}/nova-{{ openstack_release }}-{{ ansible_architecture | lower }}.tgz"

# TODO: (andymccr) remove this once https://review.openstack.org/#/c/428120/ merges
nova_reserved_host_disk_mb: 0

# If there are any Designate hosts in the environment, then enable its usage
neutron_designate_enabled: "{{ hostvars['localhost']['neutron_designate_enabled'] }}"
# If there are any Ceilometer hosts in the environment, then enable its usage
neutron_ceilometer_enabled: "{{ hostvars['localhost']['neutron_ceilometer_enabled'] }}"
